package com.bmps.springcloud.insuredmicroservice.model.trail.request;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.bmps.springcloud.insuredmicroservice.annotation.accept.Equals;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @Author :  zlc
 * @Date : 2019/9/10 10:36
 **/
public class TrailRequestHeaderModel implements Serializable {
   
    @NotNull(message="请求类型不能为空!")
    @Equals(targetValue = "WCAccept",message = "requestType字段必须为WCAccept!")
    private String requestType;
    
    @JsonProperty(value = "UUID")
    @NotBlank(message="UUID字段不能为空!")
    private String UUID;

    @NotBlank(message="sendTime字段不能为空!")
    private String sendTime;

    public String getRequestType() {
        return requestType;
    }

    public void setRequestType(String requestType) {
        this.requestType = requestType;
    }

    public String getUUID() {
        return UUID;
    }

    public void setUUID(String UUID) {
        this.UUID = UUID;
    }

    public String getSendTime() {
        return sendTime;
    }

    public void setSendTime(String sendTime) {
        this.sendTime = sendTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {return true;}

        if (o == null || getClass() != o.getClass()) {return false;}

        TrailRequestHeaderModel that = (TrailRequestHeaderModel) o;

        return new EqualsBuilder()
                .append(requestType, that.requestType)
                .append(UUID, that.UUID)
                .append(sendTime, that.sendTime)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(requestType)
                .append(UUID)
                .append(sendTime)
                .toHashCode();
    }

    @Override
    public String toString() {
        return "TrailRequestHeaderModel{" +
                "requestType='" + requestType + '\'' +
                ", UUID='" + UUID + '\'' +
                ", sendTime='" + sendTime + '\'' +
                '}';
    }
}
